<?php
	header("content-type:text/html;charset=utf-8");
	$conn = mysqli_connect("localhost:3306","root","root","weidian");
	$username=$_POST["username"];
	$userpass=$_POST["userpass"];
	$sql="select * from user where username='$username' and userpass='$userpass'";
	$result=mysqli_query($conn,$sql);
	$rows=mysqli_num_rows($result);
	if($rows==1){
		echo "1";//有这条记录，登录成功
	}else{
		echo "0";//登录失败
	}
?>